package com.konsung.ksdc.bean.netbean;

import android.os.Parcel;
import android.os.Parcelable;

import com.j256.ormlite.field.DatabaseField;
import com.j256.ormlite.table.DatabaseTable;

/**
 * 账号详细信息bean
 * Created by Administrator on 2016/3/17 0017.
 */
@DatabaseTable(tableName = "RegisterUserNetBean")
public class RegisterUserNetBean implements Parcelable {
    @DatabaseField(generatedId = true)
    private int id;
    @DatabaseField
    private String userId; // 服务端自动添加
    @DatabaseField
    private String empId; // 服务端自动添加
    @DatabaseField
    private String empName; // 姓名
    @DatabaseField
    private String userName; // 000帐号
    @DatabaseField
    private String password; // 11111
    @DatabaseField
    private String lastLogin; // null
    @DatabaseField
    private String lastLoginIp; // null
    @DatabaseField
    private String available; // "Y" 帐号是否可用
    @DatabaseField
    private int ordernum; // "1"排序
    @DatabaseField
    private String userPic; // 用户头像
    @DatabaseField
    private String userNote; // 用户签名
    @DatabaseField
    private String nickName; // 用户昵称
    @DatabaseField
    private String ownerId; // 所属群组id/用户
    @DatabaseField
    private String registerTime; //注册时间
    /**
     *
     * @return 注册时间
     */
    public String getRegisterTime() {
        return registerTime;
    }

    /**
     * 注册时间
     * @param registerTime 时间
     */
    public void setRegisterTime(String registerTime) {
        this.registerTime = registerTime;
    }



    /**
     * 构造方法
     */
    public RegisterUserNetBean() {

    }

    /**
     * 构造方法
     * @param empName 账户名
     * @param userName 真实姓名
     * @param password 密码
     */
    public RegisterUserNetBean(String empName, String userName, String
            password) {
        this.userId = null;
        this.empId = null;
        this.empName = empName;
        this.userName = userName;
        this.password = password;
        this.lastLogin = null;
        this.lastLoginIp = null;
        this.available = "Y";
        this.ordernum = 1;
    }

    /**
     * 获取用户id
     * @return 用户id
     */
    public String getUserId() {
        return userId;
    }

    /**
     * 设置用户id
     * @param userId 用户id
     */
    public void setUserId(String userId) {
        this.userId = userId;
    }

    /**
     * 获取账号id
     * @return 账号id
     */
    public String getEmpId() {
        return empId;
    }

    /**
     * 设置账号id
     * @param empId 账号id
     */
    public void setEmpId(String empId) {
        this.empId = empId;
    }

    /**
     * 获取账号名
     * @return 账号名
     */
    public String getEmpName() {
        return empName;
    }

    /**
     * 设置账号名
     * @param empName 账号名
     */
    public void setEmpName(String empName) {
        this.empName = empName;
    }

    /**
     * 获取用户真实姓名
     * @return 用户真实姓名
     */
    public String getUserName() {
        return userName;
    }

    /**
     * 设置用户真实姓名
     * @param userName 用户真实姓名
     */
    public void setUserName(String userName) {
        this.userName = userName;
    }

    /**
     * 获取密码
     * @return 密码
     */
    public String getPassword() {
        return password;
    }

    /**
     * 设置密码
     * @param password 密码
     */
    public void setPassword(String password) {
        this.password = password;
    }

    /**
     * 获取最后一次登录时间
     * @return 最后一次登录时间
     */
    public String getLastLogin() {
        return lastLogin;
    }

    /**
     * 设置最后一次登录时间
     * @param lastLogin 最后一次登录时间
     */
    public void setLastLogin(String lastLogin) {
        this.lastLogin = lastLogin;
    }

    /**
     * 获取最后一次登录ip
     * @return 最后一次登录ip
     */
    public String getLastLoginIp() {
        return lastLoginIp;
    }

    /**
     * 设置最后一次登录ip
     * @param lastLoginIp 最后一次登录ip
     */
    public void setLastLoginIp(String lastLoginIp) {
        this.lastLoginIp = lastLoginIp;
    }

    /**
     * 获取账号是否可用
     * @return 账号是否可用 "Y"代表可用
     */
    public String getAvailable() {
        return available;
    }

    /**
     * 设置账号是否可用
     * @param available 账号是否可用
     */
    public void setAvailable(String available) {
        this.available = available;
    }

    /**
     * 获取账户序号
     * @return 账户序号
     */
    public int getOrdernum() {
        return ordernum;
    }

    /**
     * 设置账户序号
     * @param ordernum 账户序号
     */
    public void setOrdernum(int ordernum) {
        this.ordernum = ordernum;
    }

    /**
     * 获取用户头像
     * @return 用户头像
     */
    public String getUserPic() {
        return userPic;
    }

    /**
     * 设置用户头像
     * @param userPic 用户头像
     */
    public void setUserPic(String userPic) {
        this.userPic = userPic;
    }

    /**
     * 获取用户昵称
     * @return 用户昵称
     */
    public String getNickName() {
        return nickName;
    }

    /**
     * 设置用户昵称
     * @param nickName 用户昵称
     */
    public void setNickName(String nickName) {
        this.nickName = nickName;
    }

    /**
     * 获取用户签名
     * @return 用户签名
     */
    public String getUserNote() {
        return userNote;
    }

    /**
     * 设置用户签名
     * @param userNote 用户签名
     */
    public void setUserNote(String userNote) {
        this.userNote = userNote;
    }

    /**
     * 获取用户信息bean的id
     * @return 用户信息bean的id
     */
    public int getId() {
        return id;
    }

    /**
     * 设置用户信息bean的id
     * @param id 用户信息bean的id
     */
    public void setId(int id) {
        this.id = id;
    }

    /**
     * 获取用户所属群组id
     * @return 用户所属群组id
     */
    public String getOwnerId() {
        return ownerId;
    }

    /**
     * 设置用户所属群组id
     * @param ownerId 用户所属群组id
     */
    public void setOwnerId(String ownerId) {
        this.ownerId = ownerId;
    }

    @Override
    public String toString() {
        return "RegisterUserNetBean{" +
                "id=" + id +
                ", userId='" + userId + '\'' +
                ", empId='" + empId + '\'' +
                ", empName='" + empName + '\'' +
                ", userName='" + userName + '\'' +
                ", password='" + password + '\'' +
                ", lastLogin='" + lastLogin + '\'' +
                ", lastLoginIp='" + lastLoginIp + '\'' +
                ", available='" + available + '\'' +
                ", ordernum=" + ordernum +
                ", userPic='" + userPic + '\'' +
                ", userNote='" + userNote + '\'' +
                ", nickName='" + nickName + '\'' +
                ", ownerId='" + ownerId + '\'' +
                "，registerTime=" + registerTime + '\'' +
                '}';
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(this.userId);
        dest.writeString(this.empId);
        dest.writeString(this.empName);
        dest.writeString(this.userName);
        dest.writeString(this.password);
        dest.writeString(this.lastLogin);
        dest.writeString(this.lastLoginIp);
        dest.writeString(this.available);
        dest.writeInt(this.ordernum);
    }

    /**
     * 序列化实体类对象
     * @param in Parcel对象
     */
    protected RegisterUserNetBean(Parcel in) {
        this.userId = in.readString();
        this.empId = in.readString();
        this.empName = in.readString();
        this.userName = in.readString();
        this.password = in.readString();
        this.lastLogin = in.readString();
        this.lastLoginIp = in.readString();
        this.available = in.readString();
        this.ordernum = in.readInt();
    }

    public static final Parcelable.Creator<RegisterUserNetBean> CREATOR = new
            Parcelable.Creator<RegisterUserNetBean>() {
                @Override
                public RegisterUserNetBean createFromParcel(Parcel source) {
                    return new RegisterUserNetBean(source);
                }

                @Override
                public RegisterUserNetBean[] newArray(int size) {
                    return new RegisterUserNetBean[size];
                }
            };

    //用来比较2个list集合相同与不同元素
    @Override
    public boolean equals(Object obj) {
        if (userId.equals(((RegisterUserNetBean) obj).getUserId())) {
            return true; //这里以userId为判定标准。
        } else {
            return false;
        }
    }
}
